#ifndef PREFIXVALIDATOR_H
#define PREFIXVALIDATOR_H

#include "global.h"
#include "stringvalidator.h"
#include "pretreatmenthandler.h"


class PrefixValidator : public StringValidator
{
public:
    PrefixValidator();
    PrefixValidator(const QString& prefix, const QString& errorMsg = "Invalid prefix")
        : m_prefix(prefix), m_errorMsg(errorMsg) {}

    ValidationResult validate(const QString& input,
                              const std::vector<ValidationOption>& options = {}) const override {
        QString processed = PretreatmentHandler::preprocess(input, options);

        if (processed.startsWith(m_prefix, PretreatmentHandler::getCaseSensitivity(options))) {
            return ValidationResult(true);
        }
        return ValidationResult(false, m_errorMsg.arg(m_prefix));
    }

private:
    QString m_prefix;
    QString m_errorMsg;
};

#endif // PREFIXVALIDATOR_H
